package com.jacobson.core.widget.security.realm

import com.jacobson.core.widget.security.authc.AuthenticationInfo
import com.jacobson.core.widget.security.authc.AuthenticationToken
import com.jacobson.core.widget.security.exception.AuthenticationException

/**
 * ================================================
 *
 *  @author Wucz on 2018/8/6 15:44
 * ================================================
 */

interface Realm {
    /**
     * 是否支持该Token的校验
     * @param token Token
     * @return true-支持，false-不支持
     */
    fun supports(token: AuthenticationToken): Boolean

    /**
     * 获取授权信息
     * @param token 待授权Token
     * @return 有效的Token对象的认证信息
     * @throws AuthenticationException 错误
     */
    @Throws(AuthenticationException::class)
    fun getAuthenticationInfo(token: AuthenticationToken): AuthenticationInfo?
}
